package game.weapon;

import game.hero.Doctor;
import game.hero.Hero;
import game.hero.Magic;
import game.hero.Sword;

public class WeaponFactory {
	public static void equipWeapon(Hero hero) {
		   Weapon weapon=null;
		   int random=(int)(Math.random()*2);
		   
		if (hero instanceof Sword) {
			if (random==0) {
				weapon=new BronzeSword("青铜剑");
			} else if (random==1) {
				weapon=new GoldenSword("倚天剑");
			}
		}else if (hero instanceof Magic||hero instanceof Doctor) {
			if (random==0) {
				weapon=new WoodStick("魔法木杖");
			}else if (random==1) {
				weapon=new GoldentStick("黄金杖");
			}
		}	
		hero.setWeapon(weapon);
		System.out.println(hero.getName()+"装备"+weapon.getName());
		}
	
}
